package com.sxz.sbs.module.telephone.presenter;

import com.sxz.sbs.app.App;
import com.sxz.sbs.module.telephone.bean.TelBookBean;
import com.sxz.sbs.module.telephone.view.TelBookView;
import com.sxz.sbs.rx.RxPresenter;
import com.sxz.sbs.rx.RxSubscriber;
import com.sxz.sbs.rx.RxUtil;

import java.util.HashMap;
import java.util.List;

/**
 * 电话薄P
 */

public class TelBookPresenter extends RxPresenter<TelBookView>{
    /**
     * 获取电话薄
     * @param map
     */
    public void getTelBook (HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().getTelBook(map)
                .compose(RxUtil.<List<TelBookBean>>handleResult())
                .subscribeWith(new RxSubscriber<List<TelBookBean>>(mView,true){
                    @Override
                    public void onNext(List<TelBookBean> data) {
                        mView.onGetTelBookSuccess(data);
                    }
                })
        );
    }
}
